import request from "../request/request";

//获取全部图书
export function getAllBooks() {
  return request().get("/api/book/findAll");
}
//查询当前用户借阅图书
export function getBorrowByUserId(userId) {
  return request().get(`/api/borrow/findByUserId/${userId}`);
}
//删除图书
export function deleteBookById(bookId) {
  return request().post(`/api/book/remove/${bookId}`);
}
//添加图书
export function addBook(bookObj) {
  return request().post('/api/book/save',{
    author:bookObj.author,
    cover: bookObj.cover,
    name: bookObj.name,
    stock: bookObj.stock,
  })
}
//修改图书
export function updateBook(newBookObj) {
  return request().post('/api/book/update',{
    id:newBookObj.id,
    author:newBookObj.author,
    cover: newBookObj.cover,
    name: newBookObj.name,
    stock: newBookObj.stock,
  });
}





